<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <link rel="stylesheet" href="/static/admin/css/font.css">
    <link rel="stylesheet" href="/static/admin/css/font-awesome.min.css">
    <style>
        .layui-form-item .layui-form-label{
            width: 120px;
        }
        .layui-form-item .layui-textarea{
            width: 190px;
        }
        #phone-one-div {display: none}
        .layui-anim {z-index: 99999 !important}
    </style>
  </head>
  
  <body>
    <div class="x-body">
        <form class="layui-form">
          {if $data.step == -1}
            <blockquote class="layui-elem-quote">
                本条申请被撤销了，请检查信息是否完整
            </blockquote>   
             
          <input type="hidden" name="step" value="0">
          {/if}
          <div class="layui-form-item">
              <label for="count" class="layui-form-label">
                  <span class="x-red">*</span>直播平台id
              </label>
              <div class="layui-input-inline">
                  <input type="number" value="{$data.live_id}" min="0" lay-verify="required" required id="live_id" name="live_id" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_name" class="layui-form-label">
                  <span class="x-red">*</span>活动名称
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.activity_name}" readonly id="activity_name" name="activity_name" lay-verify="required" required="" autocomplete="off" class="layui-input" style="background:#eee" placeholder="请填写直播平台id获取">
              </div>
          </div>
          {if condition="$adminList"}
          <div class="layui-form-item">
              <label for="admin_id" class="layui-form-label">
                  所属营销
              </label>
              <div class="layui-input-inline">
                    <select name="admin_id" lay-search lay-verify="required" required lay-filter="filter">
                        {volist name="adminList" id="value"}
                        <option value="{$value.id}" {if condition="$value.id == $data.admin_id"}selected{/if} >{$value.name}</option>
                        {/volist}
                    </select>
              </div>
          </div>
          {/if}
          <div id="area-picker">
                <div class="layui-form-item">
                    <label for="province" class="layui-form-label">
                        <span class="x-red">*</span>省
                    </label>
                    <div class="layui-input-inline" >
                        <select name="province" class="province-selector" lay-search data-value="{$data.province}" lay-filter="province-1" lay-verify="required" required>
                            <option value="">请选择省</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="city" class="layui-form-label">
                        <span class="x-red">*</span>市
                    </label>
                    <div class="layui-input-inline" >
                        <select name="city" class="city-selector" lay-search data-value="{$data.city}" lay-filter="city-1" lay-verify="required" required>
                            <option value="">请选择市</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label for="county" class="layui-form-label">
                        <span class="x-red">*</span>区
                    </label>
                    <div class="layui-input-inline" >
                        <select name="county" class="county-selector" data-value="{$data.county}" lay-filter="county-1" lay-verify="required" required>
                            <option value="">请选择区</option>
                        </select>
                    </div>
                </div>
            </div>
          <div class="layui-form-item">
              <label for="activity_venues" class="layui-form-label">
                  <span class="x-red">*</span>活动场馆
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.activity_venues}" id="activity_venues" name="activity_venues" lay-verify="required" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_address" class="layui-form-label">
                  <span class="x-red">*</span>活动场馆地址
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.activity_address}" id="activity_address" name="activity_address" lay-verify="required" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_start_time" class="layui-form-label">
                  <span class="x-red">*</span>直播开始时间
              </label>
              <div class="layui-input-inline">
                  <input type="text" lay-verify="required" required="" value="{if condition="$data.activity_start_time"}{:date('Y-m-d H:i:s',$data.activity_start_time)}{/if}" id="activity_start_time" name="activity_start_time" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_end_time" class="layui-form-label">
                  <span class="x-red">*</span>直播结束时间
              </label>
              <div class="layui-input-inline">
                  <input type="text" lay-verify="required" required="" value="{if condition="$data.activity_end_time"}{:date('Y-m-d H:i:s',$data.activity_end_time)}{/if}" id="activity_end_time" name="activity_end_time"  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_need_device" class="layui-form-label">
                  <span class="x-red">*</span>设备需求
              </label>
              <div class="layui-input-inline" style="width:215px">
                    <input type="text" value="{$data.activity_need_device}" id="activity_need_device" name="activity_need_device" autocomplete="off" class="layui-input" lay-verify="required" required="">
                    <br>
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-xs quick_radio">单机位直播</button>
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-xs quick_radio">照片直播</button>
                    <br>
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-xs quick_radio">双机位直播</button>
                    
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-xs quick_radio">单机位</button>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_need_device" class="layui-form-label">
                  <span class="x-red">*</span>是否需要推荐
              </label>
              <div class="layui-input-inline">
                  <select name="" id="need_recommend" lay-filter="need_recommend" lay-verify="required" required="">
                        <option value="">请选择</option>
                        <option value="1" {$data.need_recommend == '1'?'selected':''}>需要</option>
                        <option value="0" {$data.need_recommend == '0'?'selected':''}>不需要 - 自己找到了</option>
                  </select>
              </div>
          </div>
          
          
          <div style="display:none" id="liveer-box">
          <div class="layui-form-item">
              <label for="liveer_name" class="layui-form-label">
                  外请直播联系人
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.liveer_name}" id="liveer_name" name="liveer_name" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="liveer_phone" class="layui-form-label">
                  外请直播联系电话/微信
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.liveer_phone}" id="liveer_phone" name="liveer_phone" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="liveer_price" class="layui-form-label">
                  价格
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.liveer_price|default='0'}" id="liveer_price" name="liveer_price"  autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="liveer_bill" class="layui-form-label">
                  能否开票
              </label>
              <div class="layui-input-inline">
                    <input type="radio" name="liveer_bill" value="1" title="能" {$data.liveer_bill==1?'checked':''}>
                    <input type="radio" name="liveer_bill" value="-1" title="不能" {$data.liveer_bill==-1?'checked':''}>
              </div>
          </div>
          </div>

          
          <div class="layui-form-item">

              <div class="">
                  <div id="div1">{$data.note}</div>
                  <textarea name="note" id="note" style="display:none">{$data.note}</textarea>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button type="button" class="layui-btn" lay-filter="add" lay-submit="">
                  确定
              </button>
          </div>
      </form>
    </div>
    <script src="/static/admin/js/wangEditor.min.js"></script>
    <script>
        const E = window.wangEditor
        const editor = new E('#div1');
        const $text1 = $('#note');
        editor.config.onchange = function (html) {
            $text1.val(html);
        }
        editor.config.placeholder = '备注信息...';
        editor.config.height = 150;
        editor.config.menus = [
            'bold',
            'fontSize',
            'underline',
            'strikeThrough',
            'indent',
            'foreColor',
            'backColor',
            'justify',
            'undo',
            'redo',
        ];
        editor.create();
        $text1.val(editor.txt.html())
    
    
    layui.use(['form','layer','laydate','upload','layarea','rate'], function(){
          $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer
          ,laydate = layui.laydate
          ,upload = layui.upload
          ,layarea = layui.layarea
          ,rate = layui.rate;
            /*rate.render({
                elem: '#score'
                ,length: 10
                ,value:{$data.score?:0}
                ,text: true
                ,half: true
                ,setText: function(value){
                  this.span.text(value);
                }
            });*/
            layarea.render({
                elem: '#area-picker',
                change: function (res) {
                    //console.log(res);
                }
            });
            laydate.render({
              elem: '#activity_start_time'
              ,type: 'datetime'
            });
            laydate.render({
              elem: '#activity_end_time'
              ,type: 'datetime'
            });
          //监听提交
        form.on('submit(add)', function(data){
            $.ajax({
                type:'POST',
                dataType:'json',
                data:data.field,
                success:function(obj){
                      layer.alert(obj.msg, {icon: obj.icon},function(){
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        // 可以对父窗口进行刷新 
                        x_admin_father_reload();
                      });    
                }
            });
            return false;
        });
        form.on('select(need_recommend)', function(data){
            if(data.value == 0)
            {
                $('#liveer-box').show();
            }
            else
            {
                $('#liveer-box').hide();
            }
        });        
        $('#live_id').blur(function(){
            $.get('/admin.php/Performance/getTotalIncome?live_id='+$(this).val(),function(data){
                if(data.code == 1)
                {
                    $('#activity_name').val(data.data.title);
                }
            },'json')
        })
        $('.quick_radio').click(function(){
            var vvv = $('#activity_need_device').val();
            if(vvv)
                vvv += '+'+$(this).text()
            else
                vvv = $(this).text();
            $('#activity_need_device').val( vvv ) ;
        })
    });
    </script>
  </body>

</html>